#include "../net/GameClient.h"
#include "../common/QThreadPool.h"
#include "../common/json.hpp"
#include <unistd.h>

using json = nlohmann::json;

int main()
{
    GameClient client("111.230.12.144", 11111);
    QThreadPool threadPool;
    threadPool.Commit([&client] { client.LinkThread(); });
    threadPool.Commit([&client] { client.Loop(); });
    json root;
    root["Method"] = "Test";
    root["Body"] = "test";

    while (true) {
        client.Send(root.dump());
        std::this_thread::sleep_for(std::chrono::milliseconds(1000));
    }
    return 0;
}